package com.huzz.security.access.impl;

import com.huzz.security.access.Access;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;
import java.util.Collection;

/**
 * 描述
 *
 * @author Huzz
 * @create 2022-08-23 19:08
 */
@Component("defaultAccess")
public class DefaultAccessImpl implements Access {

    @Override
    public boolean hasPermit(HttpServletRequest request, Authentication authentication) {
        Collection<? extends GrantedAuthority> authorities = authentication.getAuthorities();

        // return authorities.contains(new SimpleGrantedAuthority(request.getRequestURI()));
        return true;
    }
}
